Fix GetRoundFromTenderbakeBlock error handling and validation#16
Merged
jevonearth merged 1 commit intov2from Mar 3, 2026
Merged
Fix GetRoundFromTenderbakeBlock error handling and validation#16jevonearth merged 1 commit intov2from
jevonearth merged 1 commit intov2from
Conversation
- Replace fmt.Println error swallowing with panic in BlockSignRequest.GetRound(), matching existing convention for impossible-state failures in consensus sign request methods. The previous behavior silently returned round 0 on error. - Tighten fitness length check from 4 to 33 bytes (minimum valid Tenderbake fitness without locked round). - Add tests with two real mainnet fitness vectors (proto_016 round 0, proto_024 round 1 reproposal) plus synthetic coverage for both fitness shapes and error rejection. Followup to #13.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Followup to #13. Addresses two issues in the contributed
GetRoundFromTenderbakeBlockand its caller:BlockSignRequest.GetRound()swallowed errors withfmt.Printlnand silently returned round 0. Replaced with panic, matching the existing convention for impossible-state failures in the otherGetRound()methods (preattestation/attestation). Round 0 is a valid value, so silent failure here could cause incorrect watermark decisions in Signatory.Fitness length validation was too weak (
< 4bytes). Tightened to< 33, the minimum valid Tenderbake fitness (without locked round). Previously, any 4+ byte input would be accepted as valid fitness.Also adds
TestGetRoundFromTenderbakeBlockwith:Test plan
go test ./protocol/core/ -run TestGetRoundFromTenderbakeBlock -vpassesgo vet ./protocol/...cleango build ./protocol/...clean